package com.mjk.manager.api.constns;

import com.mjk.common.util.StrUtils;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Getter
public enum ApiDynamic {
	CUSTOM("0","手动编写"),
	DYNAMIC("1","动态生成");	
	private String type;
	private String remark;
	ApiDynamic(String type,String remark){
		this.remark = remark;
		this.type = type;
	}



	public static Map<String, String> toMap() {
		ApiDynamic[] ary = values();
		Map<String, String> enumMap = new HashMap<>();
        for (ApiDynamic apiDynamic : ary) {
            enumMap.put(apiDynamic.getType(), apiDynamic.getRemark());
        }
		return enumMap;
	}
	
	public static String getAllRole(){
		ApiDynamic[] ary = values();
		List<String> roles = new ArrayList<>();
        for (ApiDynamic apiDynamic : ary) {
            roles.add(apiDynamic.getType());
        }
		return StrUtils.join(roles, ",");
	}


}
